package active.state.lottery;

public class LotteryActivity {

    private LotteryState lotteryState;
    private int count = 0;

    private LotteryState noLotteryState = new NoLotteryState(this);
    private LotteryState canLotteryState = new CanLotteryState(this);
    private LotteryState dispenseState = new DispenseState(this);
    private LotteryState dispenseOutState = new DispenseOutState(this);

    public LotteryActivity(int count) {
        this.lotteryState = getNoLotteryState();
        this.count = count;
    }

    public void debuctScore() {
        lotteryState.deductMoney();
    }

    public void lotteryDraw() {
        // 如果能抽奖, 调用 发奖
        if (lotteryState.lotteryDraw()) {
            lotteryState.dispensePrize();
        }
    }

    public LotteryState getLotteryState() {
        return lotteryState;
    }

    public void setLotteryState(LotteryState lotteryState) {
        this.lotteryState = lotteryState;
    }

    public int getCount() {
        int currCount = count;
        count--;
        return currCount;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public LotteryState getNoLotteryState() {
        return noLotteryState;
    }

    public LotteryState getCanLotteryState() {
        return canLotteryState;
    }

    public LotteryState getDispenseState() {
        return dispenseState;
    }

    public LotteryState getDispenseOutState() {
        return dispenseOutState;
    }
}
